<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
require_once("../conn.php");

//$numofrows = 20;

function getTopDownloadedProduct(){
    $db = new DBC();
    $sql = "SELECT * FROM t_market_downloadTimes ORDER BY num";
    return $db->fetchData($sql);
}

function getNewestProductByUploadTime(){
    $db = new DBC();
    $sql = "SELECT * FROM t_market_uploadtime ORDER BY num";
    return $db->fetchData($sql);
}

function getSuggestProduct(){
    $db = new DBC();
    $sql = "SELECT * FROM t_market_suggest ORDER BY num";
    return $db->fetchData($sql);
}

function getRealDownload(){
    $db = new DBC();
    $sql = "SELECT flashcode AS code,name,downloadtimes AS downloadTimes FROM t_product ORDER BY downloadtimes DESC LIMIT 20";
    return $db->fetchData($sql);
}

function getRealUpload(){
    $db = new DBC();
    $sql = "SELECT flashcode AS code,name,createDate AS uploadTime FROM t_product ORDER BY createDate DESC LIMIT 20";
    return $db->fetchData($sql);
}

function getRealSuggest(){
    $db = new DBC();
    $sql = "SELECT flashcode AS code,name FROM t_product WHERE top = 1 ORDER BY code DESC LIMIT 20";
    return $db->fetchData($sql);
}
?>
